﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Text;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using UmlDesigner.Model;

namespace UmlDesigner.Gui
{
    internal partial class ClassDiagramForm : Page
    {
        public ClassDiagramForm(Document d)
        {
            InitializeComponent();
            umlControl2.currentDocument = d;
        }

        public UmlControl UmlControl
        {
            get
            {
                return umlControl2;
            }
        }

        public Point GetNewItemPosition()
        {
            const int increment = 100;
            Point result = scrollingPanel1.DisplayRectangle.Location;
            result.X = -result.X + increment;
            result.Y = -result.Y + increment;

            while (umlControl2.GetItemAtPoint(result) != null)
            {
                result.X += increment;
                if (result.X > Width - increment)
                {
                    result.Y += increment;
                    result.X = increment;
                }
            }

            return result;
        }

        private void ClassDiagramForm_Paint(object sender, PaintEventArgs e)
        {
            Font f = new Font("굴림", 15);
            SolidBrush b = new SolidBrush(Color.Black);
            e.Graphics.DrawString("Hello World", f, b, new Point(10, 10));
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            // This horrible hack is necessary to work around some bug in the docking stuff which causes the
            // first MDI client to not repaint properly on startup.
            timer1.Enabled = false;
            Hide();
            Show();
        }

        private void ClassDiagramForm_DockStateChanged(object sender, EventArgs e)
        {

        }

        private void ClassDiagramForm_Load(object sender, EventArgs e)
        {

        }


    }
}
